﻿using System;

namespace Httlgd.DataCenter.Common.UserControls
{
    internal static class Helpers
    {
        internal static string SecondsToTimeFormat(double seconds)
        {
            var min = (int)seconds / 60;
            var second = (int)seconds - (min * 60);

            var strMin = min < 10 ? "0" + min.ToString() : min.ToString("##");
            var strSec = second < 10 ? "0" + second.ToString() : second.ToString("##");
            return String.Format("{0}:{1}", strMin, strSec);
        }

        internal static TimeSpan SecondToTimeSpan(int t)
        {
            var hour = (int)t / 3600;
            t = t - (hour * 3600);

            var min = (int)t / 60;
            t = t - min * 60;

            var second = t;

            return new TimeSpan(hour, min, second);
        }
        
        internal static string GetVolumnToolTip(double value)
        {
            return String.Format("{0}%", (value*100).ToString("##"));
        }
    }
}
